<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
   <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title><fmt:message key="produtos"/></title>
  <link rel="stylesheet" href="${pageContext.request.contextPath}/css/estilos.css">
  <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css">
  <script src="${pageContext.request.contextPath }/js/bootstrap.min.js"></script>
      
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="js/jquery-1.7.1.min.js"><\/script>')</script>
</head>
<body class="body">
      <div id="image-logo">
         <c:import url="${pageScope.request.contextPath}/imports/fundo.jsp"/>
      </div>
       <div id="logo">
         <c:import url="${pageScope.request.contextPath}/imports/fundo2palha.jsp"/>
      </div>
      <div id="conteudo-logomarca">
          <img src="img/logomarca.jpg">
          <p>
              <fmt:message key="conteudo-logomarca"/>
          </p>
      </div>
      <div id="red-login">

		<p>
			<fmt:message key="incentivo-login" />
			<br />
			</p>
	</div>
      <c:if test="${sessionScope.usuario == null || sessionScope.usuario == ''}">        
        <div id="barra-titulo">  
          <c:import url="${pageScope.request.contextPath}/imports/barraTitulo.jsp"/> 
        </div>
      </c:if>
      <c:if test="${sessionScope.usuario != null && sessionScope.usuario != ''}">        
        <div id="barra-titulo">  
          <c:import url="${pageScope.request.contextPath}/imports/barraTituloSessaoUser.jsp"/> 
        </div>
      </c:if>
      
      <div id="tabela-produtos-bazar">
		      <c:if test="${sucessoCadastroCompra != null}">
		         <center>
		            <font class="sucesso"><fmt:message key="sucesso-compra"/> </font>
		         </center>
		      </c:if>
		      <c:if test="${erroCadastroCompra != null}">
		         <center>
		            <font class="erro"><fmt:message key="erro-compra"/> </font>
		         </center>
		      </c:if>
		      <c:if test="${nenhumProduto != null}">
		         <center>
		            <font class="maroon"><fmt:message key="nenhum-produto-venda"/> </font>
		         </center>
		      </c:if>
		      <c:if test="">
		        <center>
		           <font class="erro"> <fmt:message key="erroBanco"/> </font>
		        </center>      
		      </c:if>
		      <table border="1" class="table table-striped table-hover">
		         <thead>  
		           <tr>
		              <th colspan="6">
		                <font class="maroon">  <fmt:message key="produtos-venda"/> </font>
		              </th>
		           </tr>
		         <tr>
		            <th>
		                <fmt:message key="produto"/>
		            </th>
		            <th>
		                <fmt:message key="imagem"/>
		            </th>
		            <th>
		                <fmt:message key="preco"/>
		            </th>
		            <th>
		                <fmt:message key="tempoUso"/>
		            </th>
		            <th> 
		                <fmt:message key="vendedor"/>
		            </th>
		            <th> 
		                <fmt:message key="detalhes"/>
		            </th>
		         </tr>
		       </thead>
		          <tbody>
		            <c:forEach var="item" items="${sessionScope.itens}">
		              <tr>
		                 <td>
		                     ${item.nome}
		                 </td>
		                 <td>
		                     <img width="40px" height="30px" src="imagem?id=${item.idProduto}&tipo=item"/>
		                 </td>
		                 <td>
		                    <fmt:formatNumber type="currency" value="${item.preco}"/>
		                 </td>
		                 <td>
		                   <fmt:message key="${item.tempoUso == 'NOVO' ? 'novo' : item.tempoUso == 'USADO' ? 'usado' : 'seminovo'}"/>
		                 </td>
		                 <td>
		                   ${item.vendedor}
		                 </td>
		                 <td>
		                   <img src="img/add.png" onclick="location.href='controleprodutos?acao=visualizarDadosProduto&idP=${item.idProduto}&idV=${item.idVendedor}'"/>
		                 </td>
		              </tr>
		            </c:forEach>
		          </tbody>
		      </table>
       </div>

<!--  -->
</body>
</html>